$(function () {
    var myChart = echarts.init(document.getElementById('main'));
    $.get("/record").done(function (data) {
        let parse = JSON.parse(data);
        var option;
        option = {
            title: {
                text: '疫苗库存变化图'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: parse.name
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['一次', '两次', '三次', '四次', '五次', '六次', '七次']
            },
            yAxis: {
                type: 'value'
            },
            series: [
                {
                    name: parse.name[0],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[0]
                },
                {
                    name: parse.name[1],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[1]
                },
                {
                    name: parse.name[2],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[2]
                },
                {
                    name: parse.name[3],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[2]
                },
                {
                    name: parse.name[4],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[4]
                },
                {
                    name: parse.name[5],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[5]
                },
                {
                    name: parse.name[6],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[6]
                },
                {
                    name: parse.name[7],
                    type: 'line',
                    stack: '总量',
                    data: parse.number[7]
                }

            ]
        };
        option && myChart.setOption(option);
    })
})